package com.smooth.site.sx.timer;

import java.util.Date;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.alibaba.fastjson.JSON;
import com.smooth.dao.gen.BSysAreaMapper;
import com.smooth.dao.gen.bean.BSysArea;
import com.smooth.dao.gen.bean.BSysAreaExample;

public class ExportJsMain {
	public static void main(String[] args) {
		Logger log = LoggerFactory.getLogger(ExportJsMain.class);
		try {
			String springFileXml = "classpath*:spring-context*.xml";
			log.info(springFileXml);
			ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(springFileXml);

			BSysAreaMapper sysAreaMapper = applicationContext.getBean(BSysAreaMapper.class);

			BSysAreaExample bsysAreaExample = new BSysAreaExample();
			List<BSysArea> blist = sysAreaMapper.selectByExample(bsysAreaExample);
			for(BSysArea bsysArea : blist) {
				String idsp = bsysArea.getParentIds();
				String[] ddf = idsp.split(",");
				
				String str2 = "";
				for(int i=(ddf.length-1);i>=0;i--) {
					str2 = str2+ddf[i]+",";
				}
				
				bsysArea.setParentIds(str2);
				
				sysAreaMapper.updateByPrimaryKeySelective(bsysArea);
				log.info("update bsysarea["+bsysArea.getName()+"]");
			}
			Date date = new Date();
		} catch (Exception e) {
			log.error("", e);
		}
	}

}
